package com.fxp.project.jiuselu.web.models.user.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.fxp.project.jiuselu.web.business.v1.pojo.*;
import com.fxp.project.jiuselu.web.business.v1.request.user.ChangePwdByPhone;
import com.fxp.project.jiuselu.web.business.v1.request.user.ChangePwdByPwd;
import com.fxp.project.jiuselu.web.business.v1.request.user.CustomManagerByUserId;
import com.fxp.project.jiuselu.web.business.v1.request.user.SetInviteUse;
import com.fxp.project.jiuselu.web.models.shareprofit.entity.JslShareProfitRecord;
import com.fxp.project.jiuselu.web.models.user.entity.JslUser;
import com.fxp.project.jiuselu.web.models.user.request.ReqLogin;
import com.fxp.project.jiuselu.web.models.user.vo.CommissionManagerInfoVo;
import com.github.pagehelper.PageInfo;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户表 服务类
 * </p>
 *
 * @author Jason.Wang
 * @since 2021-11-01
 */
public interface IJslUserService extends IService<JslUser> {

    /**
     * calculateProfit: 通过当前购买用户userid 及 金额计算出各级利润<br/>
     *
     * @param userId
     * @return
     * @author
     * @date 2021/12/26
     */
    void calculateProfit(String orderId,Long userId, BigDecimal totalPay) ;
    /**
     * getUserInfoVoByUserId: 通过用户的Id获取当前用户的信息<br/>
     *
     * @param userId
     * @return
     * @author Kai.Wang
     * @date 2021/11/1 14:21
     */
    UserInfoVo getUserInfoVoByUserId(Long userId);

    InviteUserInfoVo getUserByInviteCode(String inviteCode);

    /**
     * saveUser: 添加注册用户信息<br/>
     *
     * @param reqLogin
     * @return
     * @author Kai.Wang
     * @date 2021/11/1 14:28
     */
    boolean saveUser(ReqLogin reqLogin);

    /**
     * selectByUserPhone: 通过当前的手机号码获取用户信息<br/>
     *
     * @param userPhone
     * @return
     * @author Kai.Wang
     * @date 2021/11/1 14:42
     */
    JslUser selectByUserPhone(String userPhone);

    JslUser selectByUserPhoneAndLevle(String userPhone,Integer level);

    public String checkPhone(String phone);

    public List<UserInfoVo> selectUserByInvite(String inviteCode);

    /**
     * getUserInfoVoListByInviteId: 根据当前用户的Id获取被邀请人列表<br/>
     *
     * @param userId
     * @return
     * @author Jason.Wang
     * @date 2021/12/5 15:02
     */
    List<UserInfoVo> getUserInfoVoListByInviteId(Long userId);

    BigDecimal selectMoneyByUserId(Long userId);

    /**
     * @Description 通过邀请码查询邀请人信息
     * @Date 15:53 2022/1/3
     * @Param [inviteCode]
     * @return com.fxp.project.jiuselu.web.business.v1.pojo.InviteUserInfoVo
     * @Author M_
     **/
    InviteUserInfoVo selectUserByInviteCode(String inviteCode)  ;

    /**
     * 设置邀请人id
     * @param setInviteUse
     * @param userId
     */
    void setInviteUser(SetInviteUse setInviteUse,Long userId);

    /**
     * @Description 客户管理
     * @Date 22:54 2022/1/4
     * @Param [userId]
     * @return void
     * @Author M_
     **/
    PageInfo<CustomManagerVo> customManager(CustomManagerByUserId customManagerByUserId,Integer page,Integer pageSize) ;

    PageInfo<CustomManagerVo> customManager1(CustomManagerByUserId customManagerByUserId,Integer page,Integer pageSize) ;

    //获取没有金额的人
    Map<Long,CustomManagerVo> getJslShareProfitRecordMapNoThing(Long userId,Map<Long, CustomManagerVo> map,Integer type);

    //公共方法 计算代理金额
    Map<Long, CustomManagerVo> getJslShareProfitRecordMap(List<JslShareProfitRecord> jslShareProfitRecords, Map<Long, CustomManagerVo> map,Integer type);

    //公共方法 计算代理的客户数量
    Map<Long, CustomManagerVo> getJslShareProfitRecordNum(Map<Long, CustomManagerVo> map);



    /**
     * 获取代理人的客户
     * @param userId 代理id
     * @param type 类型：1一级代理 2.二级代理 3.一级代理客户 4.二级代理客户 5.代理客户
     * @return
     */
    List<Long> getTwoUsers(Long userId,Integer type);

    /**
     * @Description 用户管理携带个人信息
     * @Date 18:33 2022/1/6
     * @Param [userId]
     * @return java.util.List<com.fxp.project.jiuselu.web.business.v1.pojo.CustomManagerVo>
     * @Author M_
     **/
    CustomManagerInfoVo customManagerInfo(CustomManagerByUserId customManagerByUserId) ;
    /**
     * @Description 获取用户信息以及订单信息
     * @Date 22:19 2022/1/6
     * @Param [customManagerByUserId]
     * @return com.fxp.project.jiuselu.web.business.v1.pojo.CustomManagerInfoVo
     * @Author M_
     **/
    CustomUserAndorderInfoVo getUserMessageAndOrder(CustomManagerByUserId customManagerByUserId) ;

    CustomUserMessageVo getCustomUserMessage(CustomManagerByUserId customManagerByUserId) ;

    /**
     * @Description 获取提成管理信息
     * @Date 16:52 2022/1/9
     * @Param [customManagerByUserId]
     * @return com.fxp.project.jiuselu.web.models.user.vo.CommissionManagerInfoVo
     * @Author M_
     **/
    CommissionManagerInfoVo getCommission(Long userId) ;


    /**
     * @Description 通过密码修改密码
     * @Date 12:36 2022/1/10
     * @Param [changePwdByPwd]
     * @return void
     * @Author M_
     **/
    void changePwdByPwd(ChangePwdByPwd changePwdByPwd,Long userId) throws Exception;
    /**
     * @Description 通过手机号修改密码
     * @Date 13:08 2022/1/10
     * @Param [changePwdByPhone]
     * @return void
     * @Author M_
     **/
    void changePwdByPhone(ChangePwdByPhone changePwdByPhone) throws Exception;

    BigDecimal getUserMoney(Long userId);
}
